package Arrayex6;

public class Models {
	public double[] StudentsRecord(double [] ObjStudents obj){
		// khai bao 1 mang trung gian co do dai bang mang objStudents
		double [] dTemp = new double[ObjStudents.length]  ;
		System.arraycopy(obj, 0, dTemp, 0, ObjStudents.length);
		for (int i = dTemp.length-1;i>=1; i--) {
			// Find the maximum in the list[0..i]
        	StudentObject currentScores = dTemp[0];
            int currentMaxIndex = 0;
            {
                for (int j = 1; j <= i; j++) {
                    if (currentScores.getScores() > dTemp[j].getScores()) {
                        currentScores = objTemp[j];
                        currentMaxIndex = j;
                    }
                }
                // Swap list[i] with list[currentMaxIndex] if necessary;
                if (currentMaxIndex != i) {
                    objStudent[currentMaxIndex] = objTemp[i];
                    objTemp[i] = currentScores;
                }
            }
        }
        return objTemp;
			
		}
	}
}